<template>
	<view class="newgroup">

		<view class="relative both-center col">
			<view style="height: 450rpx;width: 100%;display: flex;align-items: center;justify-content: center;">
				<view>
					<uni-file-picker v-model="imageValue" fileMediatype="image" mode="grid" @select="select"
						@progress="progress" @success="success" @fail="fail" 
						:image-styles="imageStyles" style="display: block;" limit="1">
					</uni-file-picker>
				</view>
			</view>


			<image v-show="logo_list.length>0" class="upload" :src="logo_list" mode="aspectFill"></image>
			<input v-model="name" class="input" type="text" placeholder="输入星球名称" @input="name">
		</view>

		<view class="bottom">
			<view class="bo" hover-class="bp" hover-stay-time="150" @click="back">取消创建</view>
			<view class="bo" hover-class="bp" hover-stay-time="150" @click="toCreat">创建星球</view>
		</view>



	</view>
</template>

<script>
	export default {
		data() {
			return {
				name: '213',
				logo: '',
				logo_list: '',
				name: '', //星球名字
				imageStyles: {
					width: 200,
					border: {
						color: '#8b8b8b',
						radius: '10%'
					},
					
				},
				filePath:''
			}
		},
		computed: {
			ok() {
				if (this.name.length != 0 && this.logo.length != 0) return true
			}
		},
		methods: {
			back() {
				uni.navigateBack({
					delta: 1
				})
			},
			go() {
				uni.navigateTo({
					url: '../groupSet/groupSet?name=' + this.name + '&logo=' + this.logo
				})
			},
			// 之前的图片上传
			// uploadlogo() {
			// 	let _this = this
			// 	const userinfo = uni.getStorageSync('userInfo')
			// 	uni.chooseImage({
			// 		count: 1,
			// 		sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
			// 		sourceType: ['album', 'camera'], //从相册选择
			// 		success: (res) => {
			// 			console.log(res)
			// 			const tempFilePaths = res.tempFilePaths;
			// 			_this.logo_list = tempFilePaths[0]
			// 			//后端上传接口
			// 			uni.request({
			// 				url: ''
			// 			})
			// 		}
			// 	});
			// },
			back() {
				uni.reLaunch({
					url: '/pages/View/find/find'
				})
			},
			//  收费建立页面
			toCreat() {
				uni.navigateTo({
					url: '/pages/View/newPlanet/check?name=' + this.name +'&imagePath='+this.filePath
				})
			},
			//星球名字输入框
			name(e) {
				this.name = e.detail.value
			},
			success(e){
				
			},
			select(e){
				this.filePath=e.tempFiles[0].path
			}
		}
	}
</script>

<style scoped>
	.newgroup {
		background: linear-gradient(to top, #fff, #f0ffef, #fbfffb);
		height: 100%;
		width: 100%;
	}

	.opacity {
		opacity: .5;
	}

	.relative {
		width: 100%;
		height: auto;
	}

	.upload {
		margin-top: 40px;
		width: 200px;
		height: 200px;
		border-radius: 15px;
		background: #fff;
		box-shadow: 0 15px 30px rgb(56 66 104 / 6%);
	}

	/* input */
	input {
		width: calc(100vw - 60px);
		margin-top: 50px;
		height: 60px;
		border: 2px solid #eeebf1;
		background: #fafafa;
		border-radius: 20px;
		text-align: center;

		font-family: PingFangSC-Regular;
		font-size: 16px;
		font-weight: bold;
		line-height: 20px;
		letter-spacing: 0px;
		color: rgba(0, 0, 0, 0.8);
	}

	.n-right {
		/* #ifdef MP-WEIXIN */
		transform: translateX(-100px);
		/* #endif */
	}


	.bottom {
		height: 400rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.bo {
		margin: 30rpx;
		border-radius: 15rpx;
		height: 100rpx;
		width: 300rpx;
		border: 0.5rpx #cacaca solid;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	/* 点击效果 */
	.bp {
		margin: 30rpx;
		border-radius: 15rpx;
		height: 100rpx;
		width: 300rpx;
		border: 0.5rpx #cacaca solid;
		display: flex;
		justify-content: center;
		align-items: center;
		background-color: #b4b4b4;
	}
</style>